<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/14
 * Time: 0:03
 */
namespace App\libraries;
use Illuminate\Support\Facades\DB;

class Logs {

    public static function setLog($url,$return_data,$post_data=null,$apiuser=null) {

//        $_r = explode('/', trim($url, '/'));
        $return_data=json_encode($return_data,JSON_UNESCAPED_UNICODE);
        $post_data=json_encode($post_data,JSON_UNESCAPED_UNICODE);

        DB::insert("insert into `tb_logs` (`api_user`,`url`,`post_data`,`return_data`,`logtime`) values ('{$apiuser}','{$url}','{$post_data}','{$return_data}',UNIX_TIMESTAMP(now()))");

    }

}